﻿using AutoMapper;
using B.MES.FLH.WarehouseManagement.Application;
using B.MES.FLH.WarehouseManagement.Application.Dtos.Location;
using B.MES.FLH.WarehouseManagement.Domain.Entity;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Standard;
using Yitter.IdGenerator;

namespace B.MES.FLH.WarehouseManagement.Controllers
{
    /// <summary>
    /// 枯萎控制器
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class LocationController : ControllerBase
    {
        private readonly IService service;
        public LocationController(IService service)
        {
            this.service = service;
        }
        /// <summary>
        /// 库位创建
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("CreateLOCATIONMODEL")]
        public ApiResult<int> CreateLOCATIONMODEL(CreateLocationModelInput input)
        {
            return service.CreateLOCATIONMODEL(input);
        }
        /// <summary>
        /// 库位修改
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("UpdateLOCATIONMODEL")]
        public ApiResult<int> UpdateLOCATIONMODEL(UpdateLocationModelInput input)
        {
            return service.UpdateLOCATIONMODEL(input);

        }
        /// <summary>
        /// 库位删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpPost("DeleteLOCATIONMODEL")]
        public ApiResult<int> DeleteLOCATIONMODEL(string id)
        {
            return service.DeleteLOCATIONMODEL(id);

        }
        /// <summary>
        /// 库位列表
        /// </summary>
        /// <param name="page"></param>
        /// <returns></returns>
        [HttpGet("GetLOCATIONMODEL")]
        public ApiPaging<LocationModelOutput> GetLOCATIONMODEL([FromQuery]PageLocation page)
        {
            return service.GetLOCATIONMODEL(page);

        }
        /// <summary>
        /// 获取库位详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("GetLOCATIONDESC")]
        public ApiResult<LocationDescOutput> GetLOCATIONDESC([FromQuery]string id)
        {
            return service.GetLOCATIONDESC(id);

        }
    }
}
